package pl.alipiec.stockview;

import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;

import javax.naming.InitialContext;

/**
 * Helper class
 * 
 * @author Aleksandra Lipiec
 *
 */
public class StockViewHelper {
	
	public static InitialContext getContext() throws Exception
	   {
	      String jndiFilename = "config/client-jndi.properties";
	      File jndiFile = new File(jndiFilename);
	      Properties props = new Properties();
	      FileInputStream inStream = null;
	      try
	      {
	         inStream = new FileInputStream(jndiFile);
	         props.load(inStream);
	      }
	      finally
	      {
	         if (inStream != null)
	         {
	            inStream.close();
	         }
	      }
	      return new InitialContext(props);
	   }

}
